package com.xbb.controller;

import com.xbb.common.RespResult;
import com.xbb.entity.Services;
import com.xbb.entity.Statistics;
import com.xbb.service.RecommendService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 协同过滤推荐算法Controller
 */
@RestController
@CrossOrigin
@RequestMapping("/recommend")
public class RecommendController {

    @Resource
    private RecommendService recommendService;

    // 协同过滤推荐
    @RequestMapping("/data")
    public RespResult recommend(@RequestParam(value = "userId", required = false) Integer userId,
                                         @RequestParam(value = "limit", required = false) Integer limit) {
        List<Services> dataList = recommendService.selectListByRecommend(userId, limit);
        RespResult respResult = new RespResult();
        respResult.success(dataList);
        return respResult;
    }

}
